<?PHP
	class Date {
		function getMonth($mindex){
			$meses = array("","Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Setiembre","Noviembre","Diciembre");
			return $meses[(int)($mindex)];
		}
/*		function render($date){
			$dates = explode("-",$date);
			return DateHelper::getMonth($dates[1])." de ".$dates[0];
		}*/
		function renderWithBars($date){
			$tmp_date = explode("-",$date);
			return date("d/m/Y",mktime(0,0,0,$tmp_date[1],$tmp_date[2],$tmp_date[0]));
		}
		function render($date){
			$tmp_date = explode("-",$date);
			return date("d \d\e F \d\e Y",mktime(0,0,0,$tmp_date[1],$tmp_date[2],$tmp_date[0]));
		}
		
		function now($add_hour=false){
			$dateString = "Y-m-d";
			if($add_hour) $dateString .= " H:i:s";
			return date($dateString);
		}
		function leadingZero($number){
			return ($number<10) ? "0".$number : $number;
		}
		function getDuration($timer,$interpret_as="sec",$separator=":"){
			$deltas = array(100,60,60,24);
			switch($interpret_as){
				case "sec":
					$index = 1;
					break;
			}
			$result = array();
			while($timer>$deltas[$index]){
				array_push($result,Date::leadingZero($timer%$deltas[$index]));
				$timer = floor($timer/$deltas[$index]);
				$index++;
			}
			array_push($result,$timer);
			$result = array_reverse($result);
			return join($separator,$result);
			
		}
	}
?>